import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';

import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils';

import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
import { h } from 'vue';
import { Image } from 'ant-design-vue';
import dayjs from 'dayjs';

// 查询表单配置
export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    componentProps: { placeholder: '请输入待办事项标题', allowClear: true },
    fieldName: 'title',
    label: '待办事项标题',
  },
  {
    component: 'Input',
    componentProps: { placeholder: '请输入完成状态：0-未完成，1-已完成', allowClear: true },
    fieldName: 'completed',
    label: '完成状态：0-未完成，1-已完成',
  },
];

// 弹窗表单配置
export const modalSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入待办事项ID',
    },
    fieldName: 'todoId',
    label: '待办事项ID',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入待办事项标题',
    },
    fieldName: 'title',
    label: '待办事项标题',
  },
  {
    component: 'Tinymce',
    componentProps: {
      height: 300,
    },
    fieldName: 'content',
    formItemClass: 'col-span-2',
    label: '待办事项内容',
    rules: 'required',
  },
  {
    component: 'Input',
    componentProps: {
      placeholder: '请输入完成状态：0-未完成，1-已完成',
    },
    fieldName: 'completed',
    label: '完成状态：0-未完成，1-已完成',
    rules: 'required',
  },
];

// 抽屉表单配置
export const drawerSchema: FormSchemaGetter = () => {
  // 和弹窗共用
  return modalSchema();
};

// 表格列配置
export const columns: VxeGridProps['columns'] = [
  // 复选框列
  { type: 'checkbox', width: 50 },
  { title: '待办事项ID', field: 'todoId', width: 100 },
  { title: '待办事项标题', field: 'title' },
  { title: '待办事项内容', field: 'content' },
  { title: '完成状态：0-未完成，1-已完成', field: 'completed' },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 150,
  },
]; 